package com.woniu.cq.mallorder.controller;


import com.woniu.cq.mallorder.common.Result;
import com.woniu.cq.mallorder.domain.Orderitem;
import com.woniu.cq.mallorder.service.IOrderitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author daniel
 * @since 2020-09-19
 */
@RestController
@RequestMapping("/order")
public class OrderitemController {
    @Autowired
    private IOrderitemService orderitemService;
    /** 
     * @description: 订单详情 
     * @param: orderId 
     * @return: com.woniu.cq.mallorder.common.Result 
     */
    @GetMapping("/getOrderItem")
    public Result getOrderItem(Integer orderId) {
        List<Orderitem> orderitems = orderitemService.getOrderItem(orderId);
        return Result.builder().code(200).data(orderitems).msg("查询成功").build();
    }
    /** 
     * @description: 某个订单详情 
     * @param: orderItemId 
     * @return: com.woniu.cq.mallorder.common.Result 
     */
    @GetMapping("/getOneOrderItem")
    public Result getOneOrderItem(Integer orderItemId){
        Orderitem orderItem = orderitemService.getOneOrderItem(orderItemId);
        return Result.builder().code(200).data(orderItem).msg("查询成功").build();
    }
}

